package com.activemq.cn.spring;

import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Service;

@Service
public class SpringConsumer {

    @Autowired
    private JmsTemplate jmsTemplate;

    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-activemq.xml");
        SpringConsumer springConsumer = applicationContext.getBean(SpringConsumer.class);
        String obj= (String) springConsumer.jmsTemplate.receiveAndConvert();
        System.out.println("********receive task over" + obj);
    }
}


